﻿using Gwn.Library.MvpVm.Base;
using Gwn.Library.MvpVm.Constants;
using Gwn.Library.MvpVm.Interfaces;
using Gwn.Library.MvpVm.ViewModels;
using Gwn.Library.MvpVm.Views;
using Gwn.Module.Security.Commands;
using Gwn.Module.UserManager.Interfaces;
using Gwn.Module.UserManager.Layers;
using Microsoft.Practices.Unity;

namespace Gwn.Module.Security
{
    /// <summary>
    /// Security Module
    /// </summary>
    public class SecurityModule : ModuleBase
    {
        /// <summary>
        /// Registers the types.  Called before RegisterViews()
        /// </summary>
        protected override void RegisterTypes()
        {
            base.RegisterTypes();

            // Register the presenter, view and viewModel
            Container
                .RegisterType<IView, ViewModelHolderView>()
                .RegisterType<IViewModel, SecurityCommandViewModel>()
                .RegisterType<IPresenter, SecurityPresenter>()

                // Commands
                .RegisterType<IPresenterCommand, LoginCommand>(ConstantSecurity.LoginCommand)

                // Singletons
                .RegisterType<IBusinessLogicLayer, MockBll>(new ContainerControlledLifetimeManager())
                .RegisterType<IDataAccessLayer, DataAccessLayer>(new ContainerControlledLifetimeManager())
                ;
        }

    }
}
